﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace olierFrm.Web
{
    public class Cookie
    {
        public const string CookieName = "CookieUser";
        public const int CookieDays = 14;
        public static string Operator
        {
            get
            {
                if (HttpContext.Current.Request.Cookies[CookieName] == null) return null;
                return HttpContext.Current.Request.Cookies[CookieName].Values["Operator"];
            }
            set
            {
                if (HttpContext.Current.Response.Cookies[CookieName].Values["Operator"] == null)
                    HttpContext.Current.Response.Cookies[CookieName].Values.Add("Operator", value);
                HttpContext.Current.Response.Cookies[CookieName].Values["Operator"] = value;
                HttpContext.Current.Response.Cookies[CookieName].Expires = DateTime.Now.AddDays(CookieDays);
            }
        }
        public static string StoreNO
        {
            get
            {
                if (HttpContext.Current.Request.Cookies[CookieName] == null) return null;
                return HttpContext.Current.Request.Cookies[CookieName].Values["StoreNO"];
            }
            set
            {
                if (HttpContext.Current.Response.Cookies[CookieName].Values["StoreNO"] == null)
                    HttpContext.Current.Response.Cookies[CookieName].Values.Add("StoreNO", value);
                HttpContext.Current.Response.Cookies[CookieName].Values["StoreNO"] = value;
                HttpContext.Current.Response.Cookies[CookieName].Expires = DateTime.Now.AddDays(CookieDays);
            }
        }
    }
}
